<template>
    <!-- 帮助按钮 -->
    <div class="help-affix" v-if="showButton">
        <div class="help-container">
            <button class="help-button" @click="openHelp">
                <i class="fa fa-question"></i>
            </button>
            <button class="close-button" @click="hideButton">
                <i class="fa fa-times"></i>
            </button>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'
// 获取路由参数
const showButton = ref(true)

// 添加打开帮助页面的方法
function openHelp() {
    window.open('https://ryguidance.viridian.com.cn/pageFunction/SimpleDashboard.html', '_blank')
}

// 添加隐藏按钮的方法
function hideButton() {
    showButton.value = false
}
</script>

<style>
/* 帮助按钮样式 */
.help-affix {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 999;
}

.help-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.help-button {
    font-size: 30px;
    background-color: #000;
    height: 50px;
    width: 50px;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}

.close-button {
    font-size: 10px;
    height: 18px;
    width: 18px;
    border-radius: 9px;
    border: none;
    background-color: #000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    right: -4px;
    bottom: 50px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    color: white;
}

.close-button:hover {
    transform: scale(1.2);
    opacity: 1;
}

.help-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    background-color: #000;
}

.help-button:hover+.close-button {
    opacity: 1;
}

.help-button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media screen and (max-width: 768px) {
    .help-affix {
        right: 70px;
    }

    .help-button {
        width: 40px;
        height: 40px;
        font-size: 16px;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    }

    .close-button {
        width: 20px;
        height: 20px;
        font-size: 12px;
        right: -4px;
        bottom: 40px;
    }

    .help-button:hover {
        transform: translateY(-1px) scale(1.03);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}
</style>